package game.components;

public class Cordinent implements Comparable<Cordinent>
{
	private int	x;
	private int	y;

	public Cordinent(int x, int y)
	{
		this.x = x;
		this.y = y;
	}

	@Override
	public boolean equals(Object o)
	{
		if (o == this)
		{
			return true;
		}
		else if (o == null || !( o instanceof Cordinent ))
		{
			return false;
		}
		else
		{
			Cordinent c = (Cordinent) o;
			if (this.y == c.getY() && this.x == c.getX())
			{
				return true;
			}
			else
			{
				return false;
			}
		}
	}

	public int getX()
	{
		return x;
	}

	public int getY()
	{
		return y;
	}

	public void setX(int x)
	{
		this.x = x;
	}

	public void setY(int y)
	{
		this.y = y;
	}

	@Override
	public int compareTo(Cordinent arg0)
	{
		if (arg0 == null){ return 1; }
		if (this.x < arg0.getX()
				|| ( ( this.x == arg0.getX() && this.y < arg0.getY() ) ))
		{
			return -1;
		}
		else if (this.y == arg0.getY() && this.x == arg0.getX())
		{
			return 0;
		}
		else
		{
			return 1;
		}
	}
}
